#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    lb = new QLabel("HelloWorld!", this);
    btn = new QPushButton("退出", this);

    btn->setGeometry(10,30,50,50);

    /*
     * btn指向的对象发出clicked信号，MainWindow对象接受该信号，调用自身的成员方法
     * 特殊成员函数close() 完成信号处理
    */
    connect(btn,SIGNAL(clicked()),this,SLOT(close()));
}

MainWindow::~MainWindow()
{
    delete ui;

    delete lb;
    delete btn;
}
